home *** CD-ROM | disk | FTP | other *** search
- Floppy Disk Cache
-
- What is a disk cache?
- A disk cache is resident program that speeds up disk IO
- by keeping a copy of recently used sectors of the disk
- in RAM memory. It is similar to a RAM disk but has the
- advantage that files are always up-to-date on the disk.
- You can't lose files like a RAM disk does when the system crashes.
-
- This cache will typically eliminate from 50-85% of disk IO if enough
- cached sectors are installed. There is a slight CPU
- overhead in copying sectors to the cache after disk IO.
-
- Installation
- The programs cache.ttp and cstat.ttp should be placed
- in your directory for executable files, usually \bin.
- cache.ttp should be run from a shell startup file;
- for example gulam.g under Gulam or GemBoot's startup file.
- The first argument to "cache" is the size of the cache in K-bytes,
- which defaults to 50K. The size can be preceeded by a drive letter.
- Run "cache" twice if you need to cache two drives.
- If you install cache.ttp as \auto\cache.prg
- there is no way to set the drive or cache size without modifing the source.
-
- Operation
- The cache clears automatically whenever you change disks.
- Make sure all your disks have been formatted correctly with unique
- serial numbers. An early version of twister and any bit-image
- disk copy program will not generate unique serial numbers.
- An easy way to check for unique serial numbers is:
- list the root directory, switch disks, list the root directory.
- If the directory lists are identical then the serial numbers may be the same.
- You will probably trash disks even without a disk cache
- when you have non-unique serial numbers.
-
- The utility "cstat" will print some statistics averaged over
- the last 1000 (approx.) sectors of IO.
-
- Other Hints
- Using a "fast" formatter like DC Format will speed up disk IO further.
- You can also turn off write verify with DC Format or pokew in Gulam,
- but there is some risk of losing files then.
- It also helps to create all directories before anything else
- is placed on a new disk, this speeds up file creation and deletion.
-
- Compilation
- This program is written completly in C for readability and portablity.
- The cache program should be compiled with the dLibs library or MWC.
- It requires the _base, _break, and _STKSIZ variables dLibs implements.
- Non-standard compilers may require a "define short int".
- Please indicate in the source and object when you make non-trivial changes.
-
- Possible Extensions
- Modify it for multiple hard disk partitions. This is non-trivial.
- The current algorithm assumes sectors can be accessed through
- cache[sector]. The cache array would be 160K bytes for a 20M byte drive,
- and is scanned sequentially in a couple of places.
-
- Eric Gisin, egisin@UWaterloo.CA
-